<?php $this->renderPartial('/admin/menu/users', array('role' => $role));?>
<h4><?php echo Yii::t('helpdesk', ucfirst($role)); ?></h4>
<?php
foreach(Yii::app()->user->getFlashes() as $key => $message){
	echo '<div class="'.$key.'"><p>'.$message."</p></div>\n";
}
?>

<form method="get" name="frmFilter" id="frmFilter">
    <div class="form-group">
    	<input type="text" name="user" value="<?php echo $arrFilter['user']; ?>" placeholder="<?php echo Yii::t('helpdesk','Type name or email'); ?>"> 
        <input type="submit" value="<?php echo Yii::t('helpdesk','Search'); ?>">
    </div>
</form>

<table style="width: 100%;" class="table table-striped table-bordered table-nonfluid">
<tbody>
	<tr>
        <th colspan="2"><?php echo Yii::t('helpdesk', ucfirst($role)); ?></th>
        <th width="80px"><?php echo Yii::t('helpdesk','Actions'); ?></th>
	</tr>
    <?php if(!empty($arrUsers)): ?>
    <?php foreach($arrUsers as $R): ?>
	<tr>
    	<td>
			<?php echo $R['user_fullname']; ?> <?php if($R['role_id'] == 1): ?><span style="color:red;">*</span><?php endif; ?>
            <br><?php echo $R['user_email']; ?>
        </td>
        <td>
        	<i class="fa fa-phone"></i> : <?php echo !empty($R['profile_phone'])?$R['profile_phone']:'-'; ?><br>
            <i class="fa fa-map-marker"></i> : <?php echo !empty($R['profile_address'])?$R['profile_address']:'-'; ?>
        </td>
        <td align="center" style="vertical-align:middle;">
        	<?php if($R['role_id'] != 1 || ($R['role_id'] == 1 && $R['user_id'] == Yii::app()->user->id)): ?>
            <a href="/admin/<?php echo strtolower($role); ?>/?id=<?php echo $R['user_id']; ?>"><i title="<?php echo Yii::t('helpdesk','Edit'); ?>" class="glyphicon glyphicon-edit"></i></a>
            <?php else: ?>
            <i class="glyphicon glyphicon-edit" style="color:#ccc"></i>
			<?php endif; ?>
			<?php if($R['role_id'] != 1): ?>
            &nbsp;
            <a onclick="return confirm('<?php echo Yii::t('helpdesk','Are you sure you want to delete?'); ?>')" href="/admin/<?php echo strtolower($role); ?>/?id=<?php echo $R['user_id']; ?>&act=delete"><i title="<?php echo Yii::t('helpdesk','Delete'); ?>" class="glyphicon glyphicon-remove-circle"></i></a>
        	<?php else: ?>
            &nbsp;
            <i class="glyphicon glyphicon-remove-circle" style="color:#ccc"></i>
			<?php endif; ?>
        </td>
    </tr>
    <?php endforeach; ?>
    <?php else: ?>
    <tr>
    	<td colspan="2"><?php echo Yii::t('helpdesk','No data found'); ?></td>
    </tr>
    <?php endif; ?>   
</tbody></table>

<?php $this->widget('Pagination', array(
	'pages' => $objPages,
)) ?>